#include <stdio.h>

/* 1990年1月1日 是星期一 */

unsigned char monthday[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

char *weekday[] = {"日", "一", "二", "三", "四", "五", "六"};

int is_leap(int year);

int is_valid(int year, int month, int day) {
  if (year < 1583) {
    return 0;
  }

  if (month > 12 || month < 1) {
    return 0;
  }

  if (day < 1) {
    return 0;
  }

  if (month == 2) {
    if (day > monthday[month] + !!is_leap(year)) {
      return 0;
    }
    return 1;
  }

  if (day > monthday[month]) {
    return 0;
  }

  return 1;
}

int is_leap(int year)
{
  return (year % 4 == 0 && year % 100 != 0) || year % 400 == 0;
}

//使用蔡勒公式计算星期
int get_weekday(int year, int month, int day) {
  if (month == 1 || month == 2) //判断month是否为1或2　
    year--, month += 12;
  int c = year / 100;
  int y = year - c * 100;
  int week = y + y / 4 + c / 4 - 2 * c + 26 * (month + 1) / 10 + day - 1;
  while (week < 0)
    week += 7;
  week %= 7;

  return week;
}

int main()
{
    int year, month, day;
    
    scanf("%d/%d/%d", &year, &month, &day);
    if (!is_valid(year, month, day)) {
      puts("输入日期错误");
      return 1;
    }

    printf("%d年%d月%d日是星期%s\n", year, month, day, weekday[get_weekday(year, month, day)]);

    return 0;
}